<html>
<head><meta charset="utf-8"><title>anecdata / trying to help with testing · edition 2021 · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/index.html">edition 2021</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html">anecdata / trying to help with testing</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246080395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246080395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Walther <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246080395">(Jul 15 2021 at 11:20)</a>:</h4>
<p>Hello hi! Saw the tweet with call-to-action for helping test things out. On a personal project, I added a <code>rust-toolchain.toml</code> file with the contents</p>
<div class="codehilite" data-code-language="TOML"><pre><span></span><code><span class="k">[toolchain]</span>
<span class="n">channel</span> <span class="o">=</span> <span class="s">"nightly-2021-07-15"</span>
<span class="n">cargo-features</span> <span class="o">=</span> <span class="k">["edition2021"]</span>
</code></pre></div>
<p>and tried running <code>cargo fix --edition</code>. However, that results in the following:</p>
<div class="codehilite"><pre><span></span><code>error: failed to parse manifest at `/Users/walther/git/wordcrab/Cargo.toml`

Caused by:
  feature `edition2021` is required

  consider adding `cargo-features = [&quot;edition2021&quot;]` to the manifest
</code></pre></div>
<p>I know the toml is in the correct directory and being read, as I initially did not have the nightly channel mentioned and got a different error (the <code>this Cargo does not support nightly features, but...</code> lines)</p>
<p>I'm probably doing something wrong here, thanks for your patience <span aria-label="bow" class="emoji emoji-1f647" role="img" title="bow">:bow:</span></p>



<a name="246080461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246080461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Walther <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246080461">(Jul 15 2021 at 11:21)</a>:</h4>
<p>(Sidenote, could be nice if <code>cargo</code> or <code>rustup</code> had helper commands for generating the <code>rust-toolchain</code> toml file)</p>



<a name="246081814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246081814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246081814">(Jul 15 2021 at 11:37)</a>:</h4>
<p>Hmmm is cargo-features somehow not supported in rust-toolchain.toml files? Adding that line directly to the Cargo.toml file should work.</p>



<a name="246081929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246081929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246081929">(Jul 15 2021 at 11:39)</a>:</h4>
<p>(By the way, the tweet mentioned that the new edition is _almost_ ready for public testing, but we need help with a few issues before that. No big deal, just an FYI)</p>



<a name="246082424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246082424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246082424">(Jul 15 2021 at 11:45)</a>:</h4>
<p>yeah, <code>rust-toolchain</code> is only read by rustup</p>



<a name="246082725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246082725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246082725">(Jul 15 2021 at 11:48)</a>:</h4>
<p>There we go ^^</p>



<a name="246082764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246082764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246082764">(Jul 15 2021 at 11:49)</a>:</h4>
<p>Makes sense since the cargo features have nothing to do with the toolchain being used.</p>



<a name="246085436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246085436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Walther <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246085436">(Jul 15 2021 at 12:18)</a>:</h4>
<p>Aha, it needs to be in the <code>Cargo.toml</code> and not the <code>rust-toolchain.toml</code>. Wonder if the messages or instructions could be a bit clearer there, or if it was just my fault. Thanks again!</p>



<a name="246085541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246085541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246085541">(Jul 15 2021 at 12:19)</a>:</h4>
<p>It's probably the usage of the word "manifest here". Perhaps if we said "Cargo.toml" instead... cc <span class="user-mention" data-user-id="120518">@Eric Huss</span></p>



<a name="246085554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246085554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246085554">(Jul 15 2021 at 12:19)</a>:</h4>
<p>Which instructions are we looking at?</p>



<a name="246085662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246085662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246085662">(Jul 15 2021 at 12:20)</a>:</h4>
<p>I was explicitly referring to the error message:</p>
<div class="codehilite"><pre><span></span><code>Caused by:
  feature `edition2021` is required

  consider adding `cargo-features = [&quot;edition2021&quot;]` to the manifest
</code></pre></div>
<p>But maybe <span class="user-mention" data-user-id="201711">@Walther</span> had some other instructions they were going from</p>



<a name="246086360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246086360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Walther <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246086360">(Jul 15 2021 at 12:27)</a>:</h4>
<p>yeah my steps were basically</p>
<ol>
<li>see tweet, let's try this out</li>
<li>edit <code>Cargo.toml</code> to say <code>edition = 2021</code> instead of <code>2018</code></li>
<li>try to run <code>cargo fix --edition</code>, get the error </li>
</ol>
<div class="codehilite"><pre><span></span><code>cargo fix --edition
error: failed to parse manifest at `/Users/walther/git/wordcrab/Cargo.toml`

Caused by:
  feature `edition2021` is required

  this Cargo does not support nightly features, but if you
  switch to nightly channel you can add
  `cargo-features = [&quot;edition2021&quot;]` to enable this feature
</code></pre></div>
<ol start="4">
<li>create a <code>rust-toolchain.toml</code> to enable nightly and (mistakenly) add the <code>cargo-features</code> there too</li>
<li>despite the toolchain file, get the error i posted here to ask for help:</li>
</ol>
<div class="codehilite"><pre><span></span><code>cargo fix --edition
error: failed to parse manifest at `/Users/walther/git/wordcrab/Cargo.toml`

Caused by:
  feature `edition2021` is required

  consider adding `cargo-features = [&quot;edition2021&quot;]` to the manifest
</code></pre></div>
<ol start="6">
<li>correct my mistake based on your help, moving the <code>cargo-features</code> to <code>Cargo.toml</code> instead</li>
<li>run <code>cargo fix --edition</code> and get confusing errors about string formatting in <code>panic!()</code> macro calls, then realize that before the errors there were also warnings with text <code>warning: </code>src/lib.rs<code> is already on the latest edition (2021), unable to migrate further</code></li>
<li>realize that the <code>cargo fix --edition</code> wants you to _not_ modify the <code>Cargo.toml</code> in advance; it needs to be run with the old edition still in place</li>
<li>revert the edition change in <code>Cargo.toml</code> to say <code>edition = 2018</code> again, re-run <code>cargo fix --edition</code>, and now it says a bunch of <code>Migrating src/lib.rs from 2018 edition to 2021</code> etc lines</li>
<li>_now_ edit the <code>Cargo.toml</code> to say <code>edition = 2021</code><br>
and now the migration is done</li>
</ol>



<a name="246086518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246086518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246086518">(Jul 15 2021 at 12:28)</a>:</h4>
<p>yea, those messages could definitely be clearer.  I can probably do a quick PR to update them.</p>



<a name="246086531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246086531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Walther <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246086531">(Jul 15 2021 at 12:29)</a>:</h4>
<p>so i guess in a broader sense, there could be some more clarity around the differences between cargo/rustup tooling &amp; helping users to find the happy path easier</p>



<a name="246086571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246086571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Walther <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246086571">(Jul 15 2021 at 12:29)</a>:</h4>
<p>thank you! 🧡</p>



<a name="246086708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246086708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Walther <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246086708">(Jul 15 2021 at 12:30)</a>:</h4>
<p>in some sense, my original error was to edit the edition number before running cargo fix, because my intuition said that's what would make sense as the order of operations. not sure how many others will make that mistake and whether there's anything that can be done about that <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="246087037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246087037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246087037">(Jul 15 2021 at 12:34)</a>:</h4>
<p>Can we detect if users are running cargo fix on a crate with the latest known edition and if so, give them a warning?</p>



<a name="246087041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246087041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246087041">(Jul 15 2021 at 12:34)</a>:</h4>
<p>The blog post we hope to post soon (<a href="https://github.com/rust-lang/blog.rust-lang.org/blob/76bd62839433d19d49f88ccac36e7b2d65b3f64c/posts/2021-07-20-Rust-2021-public-testing.md">here</a>) tries to be very clear on the exact sequence of steps to run.  Perhaps you can read that and let us know if you have any feedback if it can be clearer?</p>



<a name="246087104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246087104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246087104">(Jul 15 2021 at 12:35)</a>:</h4>
<p>The current warning looks like this if you try to go past 2021:</p>
<div class="codehilite"><pre><span></span><code>warning: `src/main.rs` is already on the latest edition (2021), unable to migrate further
</code></pre></div>



<a name="246087146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246087146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Walther <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246087146">(Jul 15 2021 at 12:35)</a>:</h4>
<p>thanks, that post with the ordered steps looks super clear indeed <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<a name="246087317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246087317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246087317">(Jul 15 2021 at 12:37)</a>:</h4>
<p>Ah ok. Maybe we can add more text:<br>
"If you're trying to migrate from the previous edition (2018) but have already updated your Cargo.toml file with the new edition, first run the migration while still on the old edition before updating your Cargo.toml file" <br>
^^ not very good, but maybe something like this</p>



<a name="246087548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246087548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246087548">(Jul 15 2021 at 12:39)</a>:</h4>
<p>Yea, that sounds good.  We used to have a message like that, and I stupidly removed it.</p>



<a name="246087577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246087577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246087577">(Jul 15 2021 at 12:39)</a>:</h4>
<p>(It was 2015-specific, so it didn't make sense.)</p>



<a name="246092222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246092222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246092222">(Jul 15 2021 at 13:21)</a>:</h4>
<p>Ah, I forgot, a bunch of these messages have already been updated, just waiting for <a href="https://github.com/rust-lang/rust/pull/87147">https://github.com/rust-lang/rust/pull/87147</a> to merge.</p>



<a name="246104152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246104152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246104152">(Jul 15 2021 at 14:42)</a>:</h4>
<p>I did notice when I looked at the Edition Guide that the steps are actually pretty unclear</p>



<a name="246104172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246104172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246104172">(Jul 15 2021 at 14:42)</a>:</h4>
<p>we definitely need a TL;DR at the top that's like what's in the blog post</p>



<a name="246104198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/anecdata%20/%20trying%20to%20help%20with%20testing/near/246104198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/anecdata.20.2F.20trying.20to.20help.20with.20testing.html#246104198">(Jul 15 2021 at 14:42)</a>:</h4>
<p>(sorry if somebody already said that in this topic, I just skimmed :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>